package com.project.restaurant.meal.vo;


import com.project.restaurant.meal.dto.MealDetail;
import com.project.restaurant.pojo.MealType;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

@Data
@AllArgsConstructor
@Accessors(chain = true)
public class MealMenuVo {

    @ApiModelProperty(value = "餐点类型")
    private MealType mealType;
    @ApiModelProperty(value = "子菜单")
    private Set<MealMenuVo> childType = new HashSet<>();
    @ApiModelProperty(value = "该餐点类型的餐点列表")
    private Set<MealDetail> mealList = new HashSet<>();

    public MealMenuVo(MealType mealType){
        this.mealType = mealType;
    }

    public boolean addMealList(List<MealDetail> mealList){
        return this.mealList.addAll(mealList);
    }
    public boolean addMeal(MealDetail meal){
        return mealList.add(meal);
    }

    public boolean addChildMenu(MealMenuVo child){
        return childType.add(child);
    }

    @Override
    public String toString() {
        return "MealMenu{" +
                "mealType=" + mealType +
                ", childType=" + childType +
                ", mealList=" + mealList +
                '}';
    }
}
